Three-dimensional shapes of patterns provided in a sample can be measured by irradiating a sample with a beam, which does not destroy the sample. In this case, the three-dimensional shapes are measured by fitting data acquired by the beam irradiation of the sample and scattering intensity data predicted from shape models of the patterns. However, when the patterns are complicated, the number of parameters of the shape models increases. This causes a problem of an increase of the measurement time and degradation of the measurement accuracy.